var getCookie=readCookie("user")
if(!getCookie){
	location.href="login.htm"
}
var num=1
var count=0

myVue()

initData()

myPage()
$(function(){
	setCommentState()
})
function myPage(){
	var page = new Pagin({
		el:"#page",	//绑定分页div
		dataSize:count,	//数据量
		pageSize:3	,//每页数量
		func:function(){
			num=PaginJson.pageIndex
			initData()
		}
	})
}
function myVue(){
	vm=new Vue({
		el:".user_info_p_s",
		data:{
			info:[]
			
		},
		methods:{
			comment(cId,id){
				comment(cId,id)
			}
		}
		
	})
	

	
}
function comment(cId,id){
	//alert(cId+"id:"+id)
	location.href="submitComment.html?cId="+cId+"&fId="+id
}
function initData(){
	$.ajax({
		url:"http://localhost:8080/OrderForm/selectFormComment",
		data:{"uId":getCookie,
		"pageNum":num,
		"pageSize":"3"
		},
		type:"get",
		dataType:"json",
		async:false,
		success:function(data){
			var arr=new Array()
			for(var i=0;i<data.data.list.length;i++){
				
				if(data.data.list[i].dis==3){
				arr.push(data.data.list[i])	
				
				}
			}
			count=arr.length
			vm.$data.info=arr
			$(".us_jls").html("共"+data.data.total+"条记录")
		}
	})
	
}
function setCommentState(){
	var myState=vm.$data.info
	for(var i=0;i<myState.length;i++){
		isComment(myState[i].id,i)
	}
}
function isComment(id,i){
	$.ajax({
		url:"http://localhost:8080/comment/isComment",
		data:{"fId":id},
		type:"get",
		dataType:"json",
		async:false,
		success:function(data){
			
			$("#get"+i).text(data.msg)
			if(data.status==0){
				$("#comment"+i).text("评论")
			}else if(data.status==1){
				$("#comment"+i).text("追评")
			}
			
		}
	})
	}



